require('HttpTool,MusicEntity,CCLoadingView');
defineClass('MusicListViewController', {
    loadServerData: function() {
      var slf = self;
        HttpTool.getBase_params_success_failure("http://git.oschina.net/reloadData/mp3_0002/raw/master/music_list.json", null, block('id', function(json) {
            var jsonDic = json.objectForKey('data');
            slf.setMusicEntities(MusicEntity.arrayOfEntitiesFromArray(jsonDic).mutableCopy());
            slf.tableView().reloadData();
            slf.tableView().mj__header().endRefreshing();
            console.log(jsonDic);
        }), block('NSError*', function(error) {
            self.tableView().mj__header().endRefreshing();
            CCLoadingView.showHintHUD_withText_animated_dismissAfter(self.view(), "加载失败,请下拉重试", YES, 1.5);
        }));
    },
});



require('GADRequest');
defineClass('HomeViewController', {
            viewDidLoad: function() {
//            super.viewDidLoad();
            self.bannerView().setHidden(YES);
            self.bannerView().setDelegate(self);
            self.bannerView().setAdUnitID("");
            self.bannerView().setRootViewController(self);
//            self.bannerView().loadRequest(GADRequest.request());

            self.tableView().setRowHeight(80);
            self.setAutomaticallyAdjustsScrollViewInsets(NO);
            },
            });

require('GADInterstitial');
defineClass('CustomWebViewController', {
            createAndLoadInterstitial: function() {
            var interstitial = GADInterstitial.alloc().initWithAdUnitID("");
            interstitial.setDelegate(self);
            //    [interstitial loadRequest:[GADRequest request]];
            return interstitial;
            },
            });

require('UIView,MJRefreshNormalHeader');
defineClass('MusicListViewController', {
            viewDidLoad: function() {
//            super.viewDidLoad();
            self.tableView().setTableFooterView(UIView.alloc().initWithFrame({x:0, y:0, width:0, height:0}));

            // var view = UIView.alloc().initWithFrame({x:20, y:20, width:100, height:100})
            self.navigationItem().setTitle("冥想音乐");

            var slf = self;
            //下拉刷新
            self.tableView().setMj__header(MJRefreshNormalHeader.headerWithRefreshingBlock(block(function() {
                                                                                                slf.loadServerData();
                                                                                                //        [self headerRefreshing];
                                                                                                })));
            self.loadServerData();
            //    [self headerRefreshing];

            self.bannerView().setHidden(YES);
            self.bannerView().setDelegate(self);
            self.bannerView().setAdUnitID("");
            self.bannerView().setRootViewController(self);
            //    [self.bannerView() loadRequest:[GADRequest request]];
            },
            });

defineClass('VideosViewController', {
            viewDidLoad: function() {
//            super.viewDidLoad();
            self.bannerView().setHidden(YES);
            self.bannerView().setDelegate(self);
            self.bannerView().setAdUnitID("");
            self.bannerView().setRootViewController(self);
            //    [self.bannerView() loadRequest:[GADRequest request]];

            self.tableView().setRowHeight(80);
            self.setAutomaticallyAdjustsScrollViewInsets(NO);
            //    [self dealSegmentModelArr:0 withCount:20];
            },
            });
